package mylab.starters.mq.api;


import lombok.Data;
import mylab.utils.common.jackson.JacksonUtil;


@Data
public class Message {
    private String topic;
    private String content;
    private String tag;
    private String key;

    public Message(String topic) {
        this.topic = topic;
    }

    public Message(String topic, String content) {
        this(topic, content, null, null);
    }

    public Message(String topic, String content, String tag, String key) {
        assert topic != null;
        assert content != null;

        this.topic = topic;
        this.content = content;
        this.tag = tag;
        this.key = key;
    }

    @Override
    public synchronized String toString() {
        return JacksonUtil.toJsonString(this);
    }


}
